﻿<%@ Page Language="C#" MasterPageFile="~/administrator/Admin.Master" AutoEventWireup="true" CodeBehind="MayQuayPhim.aspx.cs" Inherits="KTSonline.administrator.MayQuayPhim" Title="Untitled Page" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="title">Quản lý Máy quay phim</div>
    <p runat="server" id="option" class="option">Options: 
        <asp:CheckBox ID="chkNgungBan" runat="server" AutoPostBack="True" 
            Text=" Ngưng bán" />
        <asp:CheckBox ID="chkHetHang" runat="server" AutoPostBack="True" 
            Text=" Hết hàng" />
        <asp:Button ID="btnAdd" runat="server" Text="Add product" CssClass="btnAdd" 
            onclick="btnAdd_Click"/>
    </p>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="ID" DataSourceID="LinqDataSource1" AllowPaging="True" 
        CssClass="datagrid" PageSize="15" onrowdeleting="GridView1_RowDeleting" 
        onselectedindexchanged="GridView1_SelectedIndexChanged">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="Mã SP" ReadOnly="True" 
                SortExpression="ID" />
            <asp:BoundField DataField="tenmay" HeaderText="Tên" 
                SortExpression="tenmay" />
            <asp:TemplateField HeaderText="Hình ảnh" SortExpression="thumbnail">
                <ItemTemplate>
                    <img src="<%# getImageURL(Eval("thumbnail")) %>" alt="Picture" width="50px" height="50px"/>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Giá" SortExpression="giaban">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("giaban", "{0:N0}") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Nhà sản xuất" SortExpression="nhasanxuat">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("NHA_SAN_XUAT.tennhasanxuat") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="btnSelect" runat="server" CausesValidation="False" 
                        CommandName="Select" Text="Select"></asp:LinkButton>
                    <asp:LinkButton ID="btnDelete" runat="server" CausesValidation="False" OnClientClick="return confirm('Delete this product?');"
                        CommandName="Delete" Text="Delete"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
        ContextTypeName="KTSonline.KTSonlineDataContext" EnableDelete="True" 
        TableName="MAY_QUAY_PHIMs" 
        Where="hethang == @hethang &amp;&amp; ngungban == @ngungban">
        <WhereParameters>
            <asp:ControlParameter ControlID="chkHetHang" Name="hethang" 
                PropertyName="Checked" Type="Boolean" />
            <asp:ControlParameter ControlID="chkNgungBan" Name="ngungban" 
                PropertyName="Checked" Type="Boolean" />
        </WhereParameters>
    </asp:LinqDataSource>
    <asp:DetailsView ID="DetailsView1" runat="server" 
        AutoGenerateRows="False" DataKeyNames="ID" DataSourceID="LinqDataSource2" 
        Visible="False" CssClass="datagrid" 
        onitemupdated="DetailsView1_ItemUpdated" 
        onitemupdating="DetailsView1_ItemUpdating" 
        onmodechanging="DetailsView1_ModeChanging" 
        oniteminserted="DetailsView1_ItemInserted" 
        oniteminserting="DetailsView1_ItemInserting">
        <Fields>
            <asp:TemplateField HeaderText="Mã SP" SortExpression="ID">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="txtid" ReadOnly="true" runat="server" Text='<%# Bind("ID") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Width="150px" />
            </asp:TemplateField>
            <asp:BoundField DataField="tenmay" HeaderText="Tên" 
                SortExpression="tenmay" />
            <asp:BoundField DataField="giaban" HeaderText="Giá" 
                SortExpression="giaban" />
            <asp:BoundField DataField="nhasanxuat" HeaderText="Nhà sản xuất" 
                SortExpression="nhasanxuat" />
            <asp:BoundField DataField="thumbnail" HeaderText="Thumbnail" 
                SortExpression="thumbnail" />
            <asp:BoundField DataField="hinhanh" HeaderText="Hình ảnh" 
                SortExpression="hinhanh" />
            <asp:BoundField DataField="baohanh" HeaderText="Bảo hành" 
                SortExpression="baohanh" />
            <asp:BoundField DataField="KMkemtheo" HeaderText="KM kèm theo" 
                SortExpression="KMkemtheo" />
            <asp:BoundField DataField="KMkhac" HeaderText="KM khác" 
                SortExpression="KMkhac" />
            <asp:CheckBoxField DataField="sanphamhot" HeaderText="Hot" 
                SortExpression="sanphamhot" />
            <asp:CheckBoxField DataField="sanphammoi" HeaderText="New" 
                SortExpression="sanphammoi" />
            <asp:CheckBoxField DataField="ngungban" HeaderText="Ngưng bán" 
                SortExpression="ngungban" />
            <asp:CheckBoxField DataField="hethang" HeaderText="Hết hàng" 
                SortExpression="hethang" />
            <asp:TemplateField HeaderText="Bài viết" SortExpression="baiviet">
                <EditItemTemplate>
                    <CKEditor:CKEditorControl ID="CKEditor1" runat="server" Text='<%# Bind("baiviet") %>' ResizeEnabled="False"></CKEditor:CKEditorControl>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <CKEditor:CKEditorControl ID="CKEditor1" runat="server" Text='<%# Bind("baiviet") %>' ResizeEnabled="False"></CKEditor:CKEditorControl>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("baiviet") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="zoomquanghoc" HeaderText="Zoom quang" 
                SortExpression="zoomquanghoc" />
            <asp:BoundField DataField="kichthuocmanhinh" HeaderText="Kích thước màn hình" 
                SortExpression="kichthuocmanhinh" />
            <asp:BoundField DataField="loaicambien" HeaderText="Loại cảm biến" 
                SortExpression="loaicambien" />
            <asp:BoundField DataField="kichthuoc" HeaderText="Kích thước" 
                SortExpression="kichthuoc" />
            <asp:BoundField DataField="loaipin" HeaderText="Loại pin" 
                SortExpression="loaipin" />
            <asp:BoundField DataField="congusb" HeaderText="Cổng usb" 
                SortExpression="congusb" />
            <asp:CheckBoxField DataField="ketnoitivi" HeaderText="Kết nối TV" 
                SortExpression="ketnoitivi" />
            <asp:CheckBoxField DataField="camung" HeaderText="Cảm ứng" 
                SortExpression="camung" />
            <asp:CheckBoxField DataField="conghdmi" HeaderText="Cống HDMI" 
                SortExpression="conghdmi" />
            <asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
        </Fields>
    </asp:DetailsView>
    <asp:LinqDataSource ID="LinqDataSource2" runat="server" 
        ContextTypeName="KTSonline.KTSonlineDataContext" EnableDelete="True" 
        EnableInsert="True" EnableUpdate="True" TableName="MAY_QUAY_PHIMs" 
        Where="ID == @ID">
        <WhereParameters>
            <asp:ControlParameter ControlID="GridView1" DefaultValue="0" Name="ID" 
                PropertyName="SelectedValue" Type="String" />
        </WhereParameters>
    </asp:LinqDataSource>
</asp:Content>
